defmodule EkangScraper.Application do
  # See https://hexdocs.pm/elixir/Application.html
  # for more information on OTP Applications
  @moduledoc false

  use Application

  def start(_type, _args) do
    import Supervisor.Spec

    # List all child processes to be supervised
    children = [
      :hackney_pool.child_spec(:hackney_pool, [timeout: 500_000, max_connections: 100]),
      supervisor(Task.Supervisor, [[name: EkangScraper.Task.Supervisor]]),
      worker(Agent, [fn -> nil end, [name: EkangScraper.CookieStore]]),
      EkangScraper.Repo
    ]

    # See https://hexdocs.pm/elixir/Supervisor.html
    # for other strategies and supported options
    opts = [strategy: :one_for_one, name: EkangScraper.Supervisor]
    Supervisor.start_link(children, opts)
  end
end
